package com.java.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.java.pojo.ComEmp;
import com.java.service.IEmpService;

public class EmpCheckAction {

	IEmpService empService;
	
	public String execute() {
	
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html");
		response.setCharacterEncoding("utf-8");
		try {
			PrintWriter out = response.getWriter();
			String id = request.getParameter("EId");
			ComEmp ce = empService.getEmpById(id);
			if(ce!=null){
				out.print("true");
			}else{
				out.print("false");
			}
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public IEmpService getEmpService() {
		return empService;
	}

	public void setEmpService(IEmpService empService) {
		this.empService = empService;
	}
	
}
